home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 March / PCWMAR09.iso / Software / Freeware / Adobe Media Player 1.6 / adobe_media_player.air / AMP.swf / scripts / mx / controls / ComboBase.as < prev    next >
Encoding:
Text File  |  2008-11-25  |  25.5 KB  |  764 lines

  1. package mx.controls
  2. {
  3.    import flash.display.DisplayObject;
  4.    import flash.events.Event;
  5.    import flash.events.FocusEvent;
  6.    import flash.events.KeyboardEvent;
  7.    import flash.events.MouseEvent;
  8.    import mx.collections.ArrayCollection;
  9.    import mx.collections.CursorBookmark;
  10.    import mx.collections.ICollectionView;
  11.    import mx.collections.IList;
  12.    import mx.collections.IViewCursor;
  13.    import mx.collections.ListCollectionView;
  14.    import mx.collections.XMLListCollection;
  15.    import mx.core.EdgeMetrics;
  16.    import mx.core.FlexVersion;
  17.    import mx.core.IFlexDisplayObject;
  18.    import mx.core.IIMESupport;
  19.    import mx.core.IRectangularBorder;
  20.    import mx.core.UIComponent;
  21.    import mx.core.UITextField;
  22.    import mx.core.mx_internal;
  23.    import mx.events.CollectionEvent;
  24.    import mx.events.CollectionEventKind;
  25.    import mx.events.FlexEvent;
  26.    import mx.managers.IFocusManager;
  27.    import mx.managers.IFocusManagerComponent;
  28.    import mx.styles.ISimpleStyleClient;
  29.    import mx.styles.StyleProxy;
  30.    import mx.utils.UIDUtil;
  31.    
  32.    use namespace mx_internal;
  33.    
  34.    public class ComboBase extends UIComponent implements IIMESupport, IFocusManagerComponent
  35.    {
  36.       mx_internal static var createAccessibilityImplementation:Function;
  37.       
  38.       mx_internal static const VERSION:String = "3.2.0.3958";
  39.       
  40.       private static var _textInputStyleFilters:Object = {
  41.          "backgroundAlpha":"backgroundAlpha",
  42.          "backgroundColor":"backgroundColor",
  43.          "backgroundImage":"backgroundImage",
  44.          "backgroundDisabledColor":"backgroundDisabledColor",
  45.          "backgroundSize":"backgroundSize",
  46.          "borderAlpha":"borderAlpha",
  47.          "borderColor":"borderColor",
  48.          "borderSides":"borderSides",
  49.          "borderSkin":"borderSkin",
  50.          "borderStyle":"borderStyle",
  51.          "borderThickness":"borderThickness",
  52.          "dropShadowColor":"dropShadowColor",
  53.          "dropShadowEnabled":"dropShadowEnabled",
  54.          "embedFonts":"embedFonts",
  55.          "focusAlpha":"focusAlpha",
  56.          "focusBlendMode":"focusBlendMode",
  57.          "focusRoundedCorners":"focusRoundedCorners",
  58.          "focusThickness":"focusThickness",
  59.          "leading":"leading",
  60.          "paddingLeft":"paddingLeft",
  61.          "paddingRight":"paddingRight",
  62.          "shadowDirection":"shadowDirection",
  63.          "shadowDistance":"shadowDistance",
  64.          "textDecoration":"textDecoration"
  65.       };
  66.       
  67.       private var _enabled:Boolean = false;
  68.       
  69.       mx_internal var useFullDropdownSkin:Boolean = false;
  70.       
  71.       mx_internal var selectedItemChanged:Boolean = false;
  72.       
  73.       mx_internal var selectionChanged:Boolean = false;
  74.       
  75.       mx_internal var downArrowButton:Button;
  76.       
  77.       private var _restrict:String;
  78.       
  79.       protected var collection:ICollectionView;
  80.       
  81.       private var _text:String = "";
  82.       
  83.       mx_internal var border:IFlexDisplayObject;
  84.       
  85.       private var _selectedItem:Object;
  86.       
  87.       mx_internal var editableChanged:Boolean = true;
  88.       
  89.       private var enabledChanged:Boolean = false;
  90.       
  91.       private var selectedUID:String;
  92.       
  93.       mx_internal var selectedIndexChanged:Boolean = false;
  94.       
  95.       mx_internal var oldBorderStyle:String;
  96.       
  97.       protected var textInput:TextInput;
  98.       
  99.       private var _editable:Boolean = false;
  100.       
  101.       mx_internal var collectionIterator:IViewCursor;
  102.       
  103.       mx_internal var textChanged:Boolean;
  104.       
  105.       private var _imeMode:String = null;
  106.       
  107.       protected var iterator:IViewCursor;
  108.       
  109.       mx_internal var wrapDownArrowButton:Boolean = true;
  110.       
  111.       private var _selectedIndex:int = -1;
  112.       
  113.       public function ComboBase()
  114.       {
  115.          super();
  116.          tabEnabled = true;
  117.       }
  118.       
  119.       protected function collectionChangeHandler(param1:Event) : void
  120.       {
  121.          var _loc2_:Boolean = false;
  122.          var _loc3_:Number = NaN;
  123.          var _loc4_:Object = null;
  124.          var _loc5_:CollectionEvent = null;
  125.          var _loc6_:int = 0;
  126.          var _loc7_:String = null;
  127.          if(param1 is CollectionEvent)
  128.          {
  129.             _loc2_ = false;
  130.             _loc5_ = CollectionEvent(param1);
  131.             if(_loc5_.kind == CollectionEventKind.ADD)
  132.             {
  133.                if(selectedIndex >= _loc5_.location)
  134.                {
  135.                   ++_selectedIndex;
  136.                }
  137.             }
  138.             if(_loc5_.kind == CollectionEventKind.REMOVE)
  139.             {
  140.                _loc6_ = 0;
  141.                while(_loc6_ < _loc5_.items.length)
  142.                {
  143.                   _loc7_ = itemToUID(_loc5_.items[_loc6_]);
  144.                   if(selectedUID == _loc7_)
  145.                   {
  146.                      mx_internal::selectionChanged = true;
  147.                   }
  148.                   _loc6_++;
  149.                }
  150.                if(mx_internal::selectionChanged)
  151.                {
  152.                   if(_selectedIndex >= collection.length)
  153.                   {
  154.                      _selectedIndex = collection.length - 1;
  155.                   }
  156.                   mx_internal::selectedIndexChanged = true;
  157.                   _loc2_ = true;
  158.                   invalidateDisplayList();
  159.                }
  160.                else if(selectedIndex >= _loc5_.location)
  161.                {
  162.                   --_selectedIndex;
  163.                   mx_internal::selectedIndexChanged = true;
  164.                   _loc2_ = true;
  165.                   invalidateDisplayList();
  166.                }
  167.             }
  168.             if(_loc5_.kind == CollectionEventKind.REFRESH)
  169.             {
  170.                mx_internal::selectedItemChanged = true;
  171.                _loc2_ = true;
  172.             }
  173.             invalidateDisplayList();
  174.             if(_loc2_)
  175.             {
  176.                dispatchEvent(new FlexEvent(FlexEvent.VALUE_COMMIT));
  177.             }
  178.          }
  179.       }
  180.       
  181.       override public function set enabled(param1:Boolean) : void
  182.       {
  183.          super.enabled = param1;
  184.          _enabled = param1;
  185.          enabledChanged = true;
  186.          invalidateProperties();
  187.       }
  188.       
  189.       public function get imeMode() : String
  190.       {
  191.          return _imeMode;
  192.       }
  193.       
  194.       override protected function focusOutHandler(param1:FocusEvent) : void
  195.       {
  196.          super.focusOutHandler(param1);
  197.          var _loc2_:IFocusManager = focusManager;
  198.          if(_loc2_)
  199.          {
  200.             _loc2_.defaultButtonEnabled = true;
  201.          }
  202.          if(_editable)
  203.          {
  204.             dispatchEvent(new FlexEvent(FlexEvent.VALUE_COMMIT));
  205.          }
  206.       }
  207.       
  208.       override public function get baselinePosition() : Number
  209.       {
  210.          if(FlexVersion.compatibilityVersion < FlexVersion.VERSION_3_0)
  211.          {
  212.             return textInput.y + textInput.baselinePosition;
  213.          }
  214.          if(!mx_internal::validateBaselinePosition())
  215.          {
  216.             return NaN;
  217.          }
  218.          return textInput.y + textInput.baselinePosition;
  219.       }
  220.       
  221.       public function set imeMode(param1:String) : void
  222.       {
  223.          _imeMode = param1;
  224.          if(textInput)
  225.          {
  226.             textInput.imeMode = _imeMode;
  227.          }
  228.       }
  229.       
  230.       protected function itemToUID(param1:Object) : String
  231.       {
  232.          if(!param1)
  233.          {
  234.             return "null";
  235.          }
  236.          return UIDUtil.getUID(param1);
  237.       }
  238.       
  239.       protected function downArrowButton_buttonDownHandler(param1:FlexEvent) : void
  240.       {
  241.       }
  242.       
  243.       override protected function createChildren() : void
  244.       {
  245.          var _loc1_:Class = null;
  246.          var _loc2_:Object = null;
  247.          super.createChildren();
  248.          if(!mx_internal::border)
  249.          {
  250.             _loc1_ = getStyle("borderSkin");
  251.             if(_loc1_)
  252.             {
  253.                mx_internal::border = new _loc1_();
  254.                if(mx_internal::border is IFocusManagerComponent)
  255.                {
  256.                   IFocusManagerComponent(mx_internal::border).focusEnabled = false;
  257.                }
  258.                if(mx_internal::border is ISimpleStyleClient)
  259.                {
  260.                   ISimpleStyleClient(mx_internal::border).styleName = this;
  261.                }
  262.                addChild(DisplayObject(mx_internal::border));
  263.             }
  264.          }
  265.          if(!mx_internal::downArrowButton)
  266.          {
  267.             mx_internal::downArrowButton = new Button();
  268.             mx_internal::downArrowButton.styleName = new StyleProxy(this,arrowButtonStyleFilters);
  269.             mx_internal::downArrowButton.focusEnabled = false;
  270.             addChild(mx_internal::downArrowButton);
  271.             mx_internal::downArrowButton.addEventListener(FlexEvent.BUTTON_DOWN,downArrowButton_buttonDownHandler);
  272.          }
  273.          if(!textInput)
  274.          {
  275.             _loc2_ = getStyle("textInputStyleName");
  276.             if(!_loc2_)
  277.             {
  278.                _loc2_ = new StyleProxy(this,textInputStyleFilters);
  279.             }
  280.             textInput = new TextInput();
  281.             textInput.editable = _editable;
  282.             mx_internal::editableChanged = true;
  283.             textInput.restrict = "^\x1b";
  284.             textInput.focusEnabled = false;
  285.             textInput.imeMode = _imeMode;
  286.             textInput.styleName = _loc2_;
  287.             textInput.addEventListener(Event.CHANGE,textInput_changeHandler);
  288.             textInput.addEventListener(FlexEvent.ENTER,textInput_enterHandler);
  289.             textInput.addEventListener(FocusEvent.FOCUS_IN,focusInHandler);
  290.             textInput.addEventListener(FocusEvent.FOCUS_OUT,focusOutHandler);
  291.             textInput.addEventListener(FlexEvent.VALUE_COMMIT,textInput_valueCommitHandler);
  292.             addChild(textInput);
  293.             textInput.move(0,0);
  294.             textInput.mx_internal::parentDrawsFocus = true;
  295.          }
  296.       }
  297.       
  298.       public function set selectedItem(param1:Object) : void
  299.       {
  300.          setSelectedItem(param1);
  301.       }
  302.       
  303.       override protected function initializeAccessibility() : void
  304.       {
  305.          if(ComboBase.mx_internal::createAccessibilityImplementation != null)
  306.          {
  307.             ComboBase.mx_internal::createAccessibilityImplementation(this);
  308.          }
  309.       }
  310.       
  311.       private function textInput_enterHandler(param1:FlexEvent) : void
  312.       {
  313.          dispatchEvent(param1);
  314.          dispatchEvent(new FlexEvent(FlexEvent.VALUE_COMMIT));
  315.       }
  316.       
  317.       protected function calculatePreferredSizeFromData(param1:int) : Object
  318.       {
  319.          return null;
  320.       }
  321.       
  322.       override public function setFocus() : void
  323.       {
  324.          if(Boolean(textInput) && _editable)
  325.          {
  326.             textInput.setFocus();
  327.          }
  328.          else
  329.          {
  330.             super.setFocus();
  331.          }
  332.       }
  333.       
  334.       private function textInput_valueCommitHandler(param1:FlexEvent) : void
  335.       {
  336.          _text = textInput.text;
  337.          dispatchEvent(param1);
  338.       }
  339.       
  340.       [NonCommittingChangeEvent("change")]
  341.       [Bindable("valueCommit")]
  342.       [Bindable("collectionChange")]
  343.       public function get text() : String
  344.       {
  345.          return _text;
  346.       }
  347.       
  348.       [Bindable("collectionChange")]
  349.       public function get dataProvider() : Object
  350.       {
  351.          return collection;
  352.       }
  353.       
  354.       protected function get arrowButtonStyleFilters() : Object
  355.       {
  356.          return null;
  357.       }
  358.       
  359.       public function set editable(param1:Boolean) : void
  360.       {
  361.          _editable = param1;
  362.          mx_internal::editableChanged = true;
  363.          invalidateProperties();
  364.          dispatchEvent(new Event("editableChanged"));
  365.       }
  366.       
  367.       override public function styleChanged(param1:String) : void
  368.       {
  369.          if(mx_internal::downArrowButton)
  370.          {
  371.             mx_internal::downArrowButton.styleChanged(param1);
  372.          }
  373.          if(textInput)
  374.          {
  375.             textInput.styleChanged(param1);
  376.          }
  377.          if(Boolean(mx_internal::border) && mx_internal::border is ISimpleStyleClient)
  378.          {
  379.             ISimpleStyleClient(mx_internal::border).styleChanged(param1);
  380.          }
  381.          super.styleChanged(param1);
  382.       }
  383.       
  384.       [Bindable("restrictChanged")]
  385.       public function get restrict() : String
  386.       {
  387.          return _restrict;
  388.       }
  389.       
  390.       [Bindable("valueCommit")]
  391.       [Bindable("change")]
  392.       public function get selectedItem() : Object
  393.       {
  394.          return _selectedItem;
  395.       }
  396.       
  397.       mx_internal function get ComboDownArrowButton() : Button
  398.       {
  399.          return mx_internal::downArrowButton;
  400.       }
  401.       
  402.       private function setSelectedItem(param1:Object, param2:Boolean = true) : void
  403.       {
  404.          if(!collection || collection.length == 0)
  405.          {
  406.             _selectedItem = value;
  407.             mx_internal::selectedItemChanged = true;
  408.             invalidateDisplayList();
  409.             return;
  410.          }
  411.          var _loc3_:Boolean = false;
  412.          var _loc4_:IViewCursor = collection.createCursor();
  413.          var _loc5_:int = 0;
  414.          do
  415.          {
  416.             if(param1 == _loc4_.current)
  417.             {
  418.                _selectedIndex = _loc5_;
  419.                _selectedItem = param1;
  420.                selectedUID = itemToUID(param1);
  421.                mx_internal::selectionChanged = true;
  422.                _loc3_ = true;
  423.                break;
  424.             }
  425.             _loc5_++;
  426.          }
  427.          while(_loc4_.moveNext());
  428.          
  429.          if(!_loc3_)
  430.          {
  431.             selectedIndex = -1;
  432.             _selectedItem = null;
  433.             selectedUID = null;
  434.          }
  435.          invalidateDisplayList();
  436.       }
  437.       
  438.       override protected function commitProperties() : void
  439.       {
  440.          var _loc1_:Boolean = false;
  441.          super.commitProperties();
  442.          textInput.restrict = _restrict;
  443.          if(mx_internal::textChanged)
  444.          {
  445.             textInput.text = _text;
  446.             mx_internal::textChanged = false;
  447.          }
  448.          if(enabledChanged)
  449.          {
  450.             textInput.enabled = _enabled;
  451.             mx_internal::editableChanged = true;
  452.             mx_internal::downArrowButton.enabled = _enabled;
  453.             enabledChanged = false;
  454.          }
  455.          if(mx_internal::editableChanged)
  456.          {
  457.             mx_internal::editableChanged = false;
  458.             _loc1_ = _editable;
  459.             if(mx_internal::wrapDownArrowButton == false)
  460.             {
  461.                if(_loc1_)
  462.                {
  463.                   if(mx_internal::oldBorderStyle)
  464.                   {
  465.                      setStyle("borderStyle",mx_internal::oldBorderStyle);
  466.                   }
  467.                }
  468.                else
  469.                {
  470.                   mx_internal::oldBorderStyle = getStyle("borderStyle");
  471.                   setStyle("borderStyle","comboNonEdit");
  472.                }
  473.             }
  474.             if(mx_internal::useFullDropdownSkin)
  475.             {
  476.                mx_internal::downArrowButton.mx_internal::upSkinName = _loc1_ ? "editableUpSkin" : "upSkin";
  477.                mx_internal::downArrowButton.mx_internal::overSkinName = _loc1_ ? "editableOverSkin" : "overSkin";
  478.                mx_internal::downArrowButton.mx_internal::downSkinName = _loc1_ ? "editableDownSkin" : "downSkin";
  479.                mx_internal::downArrowButton.mx_internal::disabledSkinName = _loc1_ ? "editableDisabledSkin" : "disabledSkin";
  480.                mx_internal::downArrowButton.mx_internal::changeSkins();
  481.                mx_internal::downArrowButton.invalidateDisplayList();
  482.             }
  483.             if(textInput)
  484.             {
  485.                textInput.editable = _loc1_;
  486.                textInput.mx_internal::selectable = _loc1_;
  487.                if(_loc1_)
  488.                {
  489.                   textInput.removeEventListener(MouseEvent.MOUSE_DOWN,textInput_mouseEventHandler);
  490.                   textInput.removeEventListener(MouseEvent.MOUSE_UP,textInput_mouseEventHandler);
  491.                   textInput.removeEventListener(MouseEvent.ROLL_OVER,textInput_mouseEventHandler);
  492.                   textInput.removeEventListener(MouseEvent.ROLL_OUT,textInput_mouseEventHandler);
  493.                   textInput.addEventListener(KeyboardEvent.KEY_DOWN,keyDownHandler);
  494.                }
  495.                else
  496.                {
  497.                   textInput.addEventListener(MouseEvent.MOUSE_DOWN,textInput_mouseEventHandler);
  498.                   textInput.addEventListener(MouseEvent.MOUSE_UP,textInput_mouseEventHandler);
  499.                   textInput.addEventListener(MouseEvent.ROLL_OVER,textInput_mouseEventHandler);
  500.                   textInput.addEventListener(MouseEvent.ROLL_OUT,textInput_mouseEventHandler);
  501.                   textInput.removeEventListener(KeyboardEvent.KEY_DOWN,keyDownHandler);
  502.                }
  503.             }
  504.          }
  505.       }
  506.       
  507.       protected function get textInputStyleFilters() : Object
  508.       {
  509.          return _textInputStyleFilters;
  510.       }
  511.       
  512.       public function set text(param1:String) : void
  513.       {
  514.          _text = param1;
  515.          mx_internal::textChanged = true;
  516.          invalidateProperties();
  517.          dispatchEvent(new FlexEvent(FlexEvent.VALUE_COMMIT));
  518.       }
  519.       
  520.       override protected function isOurFocus(param1:DisplayObject) : Boolean
  521.       {
  522.          return param1 == textInput || super.isOurFocus(param1);
  523.       }
  524.       
  525.       [Bindable("editableChanged")]
  526.       public function get editable() : Boolean
  527.       {
  528.          return _editable;
  529.       }
  530.       
  531.       override protected function measure() : void
  532.       {
  533.          var _loc3_:Object = null;
  534.          var _loc4_:EdgeMetrics = null;
  535.          var _loc5_:Number = NaN;
  536.          var _loc6_:Number = NaN;
  537.          var _loc7_:Number = NaN;
  538.          super.measure();
  539.          var _loc1_:Number = getStyle("arrowButtonWidth");
  540.          var _loc2_:Number = mx_internal::downArrowButton.getExplicitOrMeasuredHeight();
  541.          if(Boolean(collection) && collection.length > 0)
  542.          {
  543.             _loc3_ = calculatePreferredSizeFromData(collection.length);
  544.             _loc4_ = borderMetrics;
  545.             _loc5_ = _loc3_.width + _loc4_.left + _loc4_.right + 8;
  546.             _loc6_ = _loc3_.height + _loc4_.top + _loc4_.bottom + UITextField.mx_internal::TEXT_HEIGHT_PADDING;
  547.             measuredMinWidth = measuredWidth = _loc5_ + _loc1_;
  548.             measuredMinHeight = measuredHeight = Math.max(_loc6_,_loc2_);
  549.          }
  550.          else
  551.          {
  552.             measuredMinWidth = DEFAULT_MEASURED_MIN_WIDTH;
  553.             measuredWidth = DEFAULT_MEASURED_WIDTH;
  554.             measuredMinHeight = DEFAULT_MEASURED_MIN_HEIGHT;
  555.             measuredHeight = DEFAULT_MEASURED_HEIGHT;
  556.          }
  557.          if(FlexVersion.compatibilityVersion >= FlexVersion.VERSION_3_0)
  558.          {
  559.             _loc7_ = getStyle("paddingTop") + getStyle("paddingBottom");
  560.             measuredMinHeight += _loc7_;
  561.             measuredHeight += _loc7_;
  562.          }
  563.       }
  564.       
  565.       protected function textInput_changeHandler(param1:Event) : void
  566.       {
  567.          _text = textInput.text;
  568.          if(_selectedIndex != -1)
  569.          {
  570.             _selectedIndex = -1;
  571.             _selectedItem = null;
  572.             selectedUID = null;
  573.          }
  574.       }
  575.       
  576.       mx_internal function getTextInput() : TextInput
  577.       {
  578.          return textInput;
  579.       }
  580.       
  581.       override protected function focusInHandler(param1:FocusEvent) : void
  582.       {
  583.          super.focusInHandler(param1);
  584.          var _loc2_:IFocusManager = focusManager;
  585.          if(_loc2_)
  586.          {
  587.             _loc2_.defaultButtonEnabled = false;
  588.          }
  589.       }
  590.       
  591.       [Bindable("valueCommit")]
  592.       [Bindable("change")]
  593.       public function get value() : Object
  594.       {
  595.          if(_editable)
  596.          {
  597.             return text;
  598.          }
  599.          var _loc1_:Object = selectedItem;
  600.          if(_loc1_ == null || typeof _loc1_ != "object")
  601.          {
  602.             return _loc1_;
  603.          }
  604.          return _loc1_.data != null ? _loc1_.data : _loc1_.label;
  605.       }
  606.       
  607.       private function textInput_mouseEventHandler(param1:Event) : void
  608.       {
  609.          mx_internal::downArrowButton.dispatchEvent(param1);
  610.       }
  611.       
  612.       public function set selectedIndex(param1:int) : void
  613.       {
  614.          var _loc2_:CursorBookmark = null;
  615.          var _loc3_:int = 0;
  616.          var _loc4_:Object = null;
  617.          var _loc5_:String = null;
  618.          _selectedIndex = param1;
  619.          if(param1 == -1)
  620.          {
  621.             _selectedItem = null;
  622.             selectedUID = null;
  623.          }
  624.          if(!collection || collection.length == 0)
  625.          {
  626.             mx_internal::selectedIndexChanged = true;
  627.          }
  628.          else if(param1 != -1)
  629.          {
  630.             param1 = Math.min(param1,collection.length - 1);
  631.             _loc2_ = iterator.bookmark;
  632.             _loc3_ = param1;
  633.             iterator.seek(CursorBookmark.FIRST,_loc3_);
  634.             _loc4_ = iterator.current;
  635.             _loc5_ = itemToUID(_loc4_);
  636.             iterator.seek(_loc2_,0);
  637.             _selectedIndex = param1;
  638.             _selectedItem = _loc4_;
  639.             selectedUID = _loc5_;
  640.          }
  641.          mx_internal::selectionChanged = true;
  642.          invalidateDisplayList();
  643.          dispatchEvent(new FlexEvent(FlexEvent.VALUE_COMMIT));
  644.       }
  645.       
  646.       public function set dataProvider(param1:Object) : void
  647.       {
  648.          var _loc3_:Array = null;
  649.          if(param1 is Array)
  650.          {
  651.             collection = new ArrayCollection(param1 as Array);
  652.          }
  653.          else if(param1 is ICollectionView)
  654.          {
  655.             collection = ICollectionView(param1);
  656.          }
  657.          else if(param1 is IList)
  658.          {
  659.             collection = new ListCollectionView(IList(param1));
  660.          }
  661.          else if(param1 is XMLList)
  662.          {
  663.             collection = new XMLListCollection(param1 as XMLList);
  664.          }
  665.          else
  666.          {
  667.             _loc3_ = [param1];
  668.             collection = new ArrayCollection(_loc3_);
  669.          }
  670.          iterator = collection.createCursor();
  671.          mx_internal::collectionIterator = collection.createCursor();
  672.          collection.addEventListener(CollectionEvent.COLLECTION_CHANGE,collectionChangeHandler,false,0,true);
  673.          var _loc2_:CollectionEvent = new CollectionEvent(CollectionEvent.COLLECTION_CHANGE);
  674.          _loc2_.kind = CollectionEventKind.RESET;
  675.          collectionChangeHandler(_loc2_);
  676.          dispatchEvent(_loc2_);
  677.          invalidateSize();
  678.          invalidateDisplayList();
  679.       }
  680.       
  681.       protected function get borderMetrics() : EdgeMetrics
  682.       {
  683.          if(Boolean(mx_internal::border) && mx_internal::border is IRectangularBorder)
  684.          {
  685.             return IRectangularBorder(mx_internal::border).borderMetrics;
  686.          }
  687.          return EdgeMetrics.EMPTY;
  688.       }
  689.       
  690.       public function set restrict(param1:String) : void
  691.       {
  692.          _restrict = param1;
  693.          invalidateProperties();
  694.          dispatchEvent(new Event("restrictChanged"));
  695.       }
  696.       
  697.       override protected function updateDisplayList(param1:Number, param2:Number) : void
  698.       {
  699.          var _loc7_:EdgeMetrics = null;
  700.          var _loc8_:Number = NaN;
  701.          var _loc9_:Number = NaN;
  702.          var _loc10_:Number = NaN;
  703.          super.updateDisplayList(param1,param2);
  704.          var _loc3_:Number = param1;
  705.          var _loc4_:Number = param2;
  706.          var _loc5_:Number = getStyle("arrowButtonWidth");
  707.          var _loc6_:Number = textInput.getExplicitOrMeasuredHeight();
  708.          if(isNaN(_loc5_))
  709.          {
  710.             _loc5_ = 0;
  711.          }
  712.          if(mx_internal::wrapDownArrowButton)
  713.          {
  714.             _loc7_ = borderMetrics;
  715.             _loc8_ = _loc4_ - _loc7_.top - _loc7_.bottom;
  716.             mx_internal::downArrowButton.setActualSize(_loc8_,_loc8_);
  717.             mx_internal::downArrowButton.move(_loc3_ - _loc5_ - _loc7_.right,_loc7_.top);
  718.             mx_internal::border.setActualSize(_loc3_,_loc4_);
  719.             textInput.setActualSize(_loc3_ - _loc5_,_loc6_);
  720.          }
  721.          else if(!_editable && mx_internal::useFullDropdownSkin)
  722.          {
  723.             _loc9_ = getStyle("paddingTop");
  724.             _loc10_ = getStyle("paddingBottom");
  725.             mx_internal::downArrowButton.move(0,0);
  726.             mx_internal::border.setActualSize(_loc3_,_loc4_);
  727.             textInput.setActualSize(_loc3_ - _loc5_,_loc6_);
  728.             textInput.mx_internal::border.visible = false;
  729.             if(FlexVersion.compatibilityVersion >= FlexVersion.VERSION_3_0)
  730.             {
  731.                textInput.move(textInput.x,(_loc4_ - _loc6_ - _loc9_ - _loc10_) / 2 + _loc9_);
  732.             }
  733.             mx_internal::downArrowButton.setActualSize(param1,param2);
  734.          }
  735.          else
  736.          {
  737.             mx_internal::downArrowButton.move(_loc3_ - _loc5_,0);
  738.             mx_internal::border.setActualSize(_loc3_ - _loc5_,_loc4_);
  739.             textInput.setActualSize(_loc3_ - _loc5_,_loc4_);
  740.             mx_internal::downArrowButton.setActualSize(_loc5_,param2);
  741.             textInput.mx_internal::border.visible = true;
  742.          }
  743.          if(mx_internal::selectedIndexChanged)
  744.          {
  745.             selectedIndex = selectedIndex;
  746.             mx_internal::selectedIndexChanged = false;
  747.          }
  748.          if(mx_internal::selectedItemChanged)
  749.          {
  750.             selectedItem = selectedItem;
  751.             mx_internal::selectedItemChanged = false;
  752.          }
  753.       }
  754.       
  755.       [Bindable("valueCommit")]
  756.       [Bindable("change")]
  757.       public function get selectedIndex() : int
  758.       {
  759.          return _selectedIndex;
  760.       }
  761.    }
  762. }
  763.  
  764.